package co.gov.medellin.ssti.sub.model.service.impl;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import co.gov.medellin.ssti.sub.model.dao.AtributosDAO;
import co.gov.medellin.ssti.sub.model.dao.exception.DAOException;
import co.gov.medellin.ssti.sub.model.service.AtributosService;
import co.gov.medellin.ssti.sub.model.vo.AtributoVO;

@Service
@Transactional
public class AtributosServiceImpl implements AtributosService {
	@Autowired
	AtributosDAO atributosDAOImpl2;

	public Collection<AtributoVO> findAtributosSubprograma(
			Long codeSubprograma, String vigencia, int opcion) {
		try {
			return atributosDAOImpl2.findAtributosSubprograma(codeSubprograma,
					vigencia, opcion);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public AtributoVO findAtributoEGSubprograma(Long codeSubprograma) {
		try {
			return atributosDAOImpl2.findAtributoEGSubprograma(codeSubprograma);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public AtributoVO findAtributoByCodigoAndVigencia(Long codigoAtributo,
			String vigencia) {
		try {
			return atributosDAOImpl2.findAtributoByCodigoAndVigencia(
					codigoAtributo, vigencia);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public AtributoVO findAtributoByCodigo(Long codigoAtributo) {
		try {
			return atributosDAOImpl2.findAtributoByCodigo(codigoAtributo);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int findMaxCodigoRestriccion() {
		try {
			return atributosDAOImpl2.findMaxCodigoRestriccion();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int findAtributosValidarLista(Long codeSubprograma) {
		try {
			return atributosDAOImpl2.findAtributosValidarLista(codeSubprograma);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int insertBeneficiarioAtri(String strValor, String strTipodato,
			Long codeAtributo, Long codeBeneficiario, int i, String[] strArrIns) {
		try {
			return atributosDAOImpl2.insertBeneficiarioAtri(strValor,
					strTipodato, codeAtributo, codeBeneficiario, i, strArrIns);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int insertBeneficioAtri(String strValor, String strTipodato,
			Long codeAtri, Long codeBot, int i, String[] strArrIns) {
		try {
			return atributosDAOImpl2.insertBeneficioAtri(strValor, strTipodato,
					codeAtri, codeBot, i, strArrIns);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int updateBeneficioAtri(String strValor, String strTipodato,
			Long codeAtri, Long codeBot, int i, String[] strArrIns) {
		try {
			return atributosDAOImpl2.updateBeneficioAtri(strValor, strTipodato,
					codeAtri, codeBot, i, strArrIns);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int insertRestriccion(String[] arr) {
		try {
			return atributosDAOImpl2.insertRestriccion(arr);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int activarAtributo(Long codeSubprograma, Long codeAtri) {
		try {
			return atributosDAOImpl2.activarAtributo(codeSubprograma, codeAtri);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int updateCampoRestAtri(Long codeSubprograma, Long codeAtri,
			Long codeMaxRest, String[] strArrAct) {
		try {
			return atributosDAOImpl2.updateCampoRestAtri(codeSubprograma,
					codeAtri, codeMaxRest, strArrAct);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public List<AtributoVO> findAtributosSAB(Long codeSubprog) {
		try {
			return atributosDAOImpl2.findAtributosSAB(codeSubprog);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String findNombreAtributoSAB(Long codeAtri) {
		try {
			return atributosDAOImpl2.findNombreAtributoSAB(codeAtri);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String findFechaBeneficio(String strIncrement) {
		try {
			return atributosDAOImpl2.findFechaBeneficio(strIncrement);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String findCodeAtributoGenerico(String nombreAtri) {
		try {
			return atributosDAOImpl2.findCodeAtributoGenerico(nombreAtri);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String findTTVFCodeAtributoGenerico(String nombreAtri) {
		try {
			return atributosDAOImpl2.findTTVFCodeAtributoGenerico(nombreAtri);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int updateValidarLista(Long codeAtri) {
		try {
			return atributosDAOImpl2.updateValidarLista(codeAtri);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public Collection<AtributoVO> findAtributoSubprogramaBOTEmpresa() {
		try {
			return atributosDAOImpl2.findAtributoSubprogramaBOTEmpresa();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}
}
